package edu.spec.lyq.week02;

import java.util.Scanner;
public class Two {
    public static void main(String args[]){

        int x,y=0;
        Scanner in = new Scanner(System.in);
        x = in.nextInt();
        if(x<1) y=x;
        if(x>=1 && x<10) y=3*x-2;
        if(x>=10) y=4*x;
        System.out.println(y);
    }
}
